const app = getApp();
const notification = require("../utils/WxNotificationCenter.js");
/**
 * 路由导航
 */
export default class Router {
    
    constructor() {
        
    }

    /**
     * 地址列表(跳转)
     */
    static addressIndexRedirect(reload = false) {
        this.redirectTo(`/pages/address/index/index?reload=${reload}`);
    }

    /**
    * 地址列表
    */
    static addressIndex(mode = 'none', selectedId) {
      this.goto(`/pages/address/index/index?mode=${mode}&selectId=${selectedId}`);
    }

    /**
     * 地址详情页面
     */
    static addressEdit(address) {
        console.log(address)
        this.goto(`/pages/address/edit/edit?addr=${address}`);
    }

    /**
     * 选择优惠券
     */
    static couponsUse(coupons){
        this.goto(`/pages/coupon/use/use?coupons=${coupons}`);
    }
    
    static goto(url) {
        wx.navigateTo({
            url: url
        });
    }

    static redirectTo(url) {
        wx.redirectTo({
            url: url
        });
    }

    //返回一次
    static back() {
        wx.navigateBack({
            delta: 1,
        });
    }
}